<template>
  <div class="home_search main">
    <!-- <a class="toHome" :href="url">
      <img src="@/assets/img/zhuzhanLogo.png" alt />
    </a> -->
    <div class="search_count">
      <el-input v-model="search" suffix-icon='el-icon-search' @change="stdValueChange(index, indexItem)"
        placeholder="搜索"></el-input>
      <router-link :to="{path:'/JobHunting',query:{search:search}}">
        <el-button type="primary" @click="getJobByName">搜索</el-button>
      </router-link>
    </div>

  </div>
</template>

<script>
export default {
  name: 'home_search',
  data () {
    return {
      url: '',
      search: ''
    };
  },
  created () {
    console.log(this.$route.query, '获取地址栏参数');
    if (this.$route.query.search) {
      this.search = this.$route.query.search;
      this.getJobByName();
    }
    this.url = process.env.VUE_APP_URL || '';
  },
  methods: {
    stdValueChange () {
      console.log(333)
      this.$EventBus.$emit('getJobByName', this.search);
    },
    getJobByName () {
      // this.$router.push({
      //     path: '/JobHunting/jobdetail',
      //     query: city
      // })
      //   let searchVal = this.search.split(' ').join(',') // 如果实现多条件搜索 解开开注释 time: qixiaofei
      this.$EventBus.$emit('getJobByName', this.search);
    }
  }
};
</script>

<style lang="css">
.home_search {
    height: 144px;
    /* display: flex;
    align-items: center; */
    /* margin: 40px auto; */
    width: 100%;
    background-image: url('../../assets/img/zs-08.png');
    background-size: 100% 100%;
}
.toHome {
    width: 394px;
    height: 67px;
}
.toHome img {
    width: 100%;
    width: 100%;
}
.home_search .el-input {
    /* margin-left: 140px; */
    width: 200px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0px 0px 6px rgba(51, 51, 51, 0.16);
    opacity: 1;
}
.home_search .el-input input {
    /* height: 48px; */
}
.search_count {
    float: right;
    margin-right: 100px;
    margin-top: 55px;
}
.home_search .el-button {
    width: 60px;
    height: 32px;
    background: rgba(24, 147, 252, 1);
    opacity: 1;
    font-size: 14px;
    /* font-family: PingFang SC;
    font-weight: 400;
    line-height: 22px; */
    color: rgba(255, 255, 255, 1);
    opacity: 1;
    border-radius: 0px !important;
}
</style>